<html>

<head>

    <title>Help On LaTeX Math Formulas</title>

    <link rel="stylesheet" type="text/css" title="Help with LaTeX" href="latex.css">

</head>

<body>


<h2>Math Formulas</h2>


<p>There are four environments that put LaTeX in math mode:</p>


<ul>

    <li><a href="#math">math</a> (see below)</li>

    <li><a href="ltx-421.html">displaymath</a></li>

    <li><a href="ltx-223.html">eqnarray</a></li>

    <li><a href="ltx-224.html">equation</a></li>

</ul>


<p>All four of these environments are typeset in math

    <a href="ltx-130.html">mode</a>, using a math italic font and LaTeX

    ideas about spacing in math mode. (See also <a href="mathfonts.html">math

        fonts and styles</a>.)</p>


<p>The math environment is for formulas that

    appear right in the text. The displaymath, eqnarray, and equation

    environments are for formulas that apppear on their own line(s).

    The math environment can be used in both paragraph and LR mode, but

    displaymath, eqnarray, and equation environments can be used only

    in paragraph mode.</p>


<h3><a name="math">Math environment</a></h3>


<p>The math environment may be specified, as with all environments, by</p>



<pre>

  <tt>\begin{math} math equation \end{math}</tt>

</pre>


<p>However, it is used so often that it has two equivalent shorter forms:</p>



<pre>

  <tt>\( math equation \)</tt> 

</pre>


<p>or just</p>



<pre>

  <tt>$ math equation $</tt>

</pre>


<p>In <a href="versions.html">LaTeX2e</a> one can also use</p>



<pre>

  <tt><a href="ensuremath.html">\ensuremath</a>{math equation}</tt>

</pre>


<p>For example,

    <a href="ltx-179.html">Subscripts</a> and

    <a href="ltx-180.html">superscripts</a> can only be used in math

    mode. To include these in running text one could use:</p>



<pre>

  <tt>The formula for water is H$_2$O.

      If the hypotenuse is $c$, then $c^2=a^2+b^2$.</tt>

</pre>


<p>Note that it is standard to use math mode for letters, such as the

    the <tt>$c$</tt> above, which are math variables.</p>


<hr noshade="noshade" size="1">


<h3>Related topics</h3>


<ul>

    <li><a href="ltx-421.html">Displaymath environment</a></li>

    <li><a href="ltx-223.html">Eqnarray environment</a></li>

    <li><a href="ltx-224.html">Equation environment</a></li>

</ul>


<ul>

    <li><a href="ltx-130.html">LaTeX Modes</a></li>

</ul>


<ul>

    <li><a href="mathfonts.html">Math fonts and styles</a></li>

    <li><a href="ltx-179.html">Subscripts</a> and

        <a href="ltx-180.html">Superscripts</a></li>

    <li><a href="ltx-117.html">Math Symbols</a></li>

    <li><a href="ltx-118.html">Spacing in Math Mode</a></li>

    <li><a href="ltx-119.html">Math Miscellany</a></li>

    <li><a href="ellipses.html">Ellipses</a></li>

</ul>


<ul>

    <li><tt><a href="boldmath.html">\boldmath</a></tt> for a bold math font</li>

    <li><tt><a href="ltx-235.html">\frac</a></tt> for generating built-up

        fractions
    </li>

    <li><tt><a href="stackrel.html">\stackrel</a></tt> for putting things above

        each other
    </li>

    <li><tt><a href="ltx-319.html">\sqrt</a></tt> for square (and nth) roots</li>

</ul>


</body>
</html>